package com.atguigu.tingshu.album.mapper;

import com.atguigu.tingshu.model.album.AlbumInfo;
import com.atguigu.tingshu.query.album.AlbumInfoQuery;
import com.atguigu.tingshu.vo.album.AlbumListVo;
import com.atguigu.tingshu.vo.album.AlbumStatVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface AlbumInfoMapper extends BaseMapper<AlbumInfo> {

    IPage<AlbumListVo> selectUserAlbumPage(Page<AlbumListVo> albumInfoPage,@Param("vo") AlbumInfoQuery albumInfoQuery);

    @Update("update album_stat\n" +
            "        set stat_num = stat_num + #{count}\n" +
            "where album_id = #{albumId} and stat_type = #{statType} and is_deleted =0")
    void updateStat(@Param("albumId") Long albumId,@Param("statPlay") String statPlay,@Param("count") Integer count);
}
